public class Text {
    //合并两个有序链表
    public MySingleList.ListNode mergeTwoLists(MySingleList.ListNode list1, MySingleList.ListNode list2) {
        MySingleList.ListNode newList = new MySingleList.ListNode(-1);
        MySingleList.ListNode tmp = newList;

        while(list1 != null && list2 != null){
            if(list1.val < list2.val){
                tmp.next = list1;
                list1 = list1.next;
                tmp = tmp.next;
            } else {
                tmp.next = list2;
                list2 = list2.next;
                tmp = tmp.next;
            }
        }
        if(list1 != null){
            tmp.next = list1;
        } else {
            tmp.next = list2;
        }

        return newList.next;

    }


}
